﻿using System;
using CodeParser.Tokens;

namespace CodeParser.Expressions
{
    public class TreeParser
    {

        internal Language Language;

        public TreeParser(Language language)
        {
            Language = language;
        }

        public Document Parse(Token[] tokens)
        {
            if (tokens == null) throw new ArgumentNullException("Tokens");
            var result = tokens.Length == 0 ? new Document() : (Document)Language.DocumentParser.Parse(tokens, 0);
            return result;
        }
        
    }
}
